package com.happy.controller;

import com.happy.mapper.GoodsMapper;
import com.happy.pojo.HpGoods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("test")
public class TestController {
    @Autowired
    GoodsMapper goodsMapper;

    @RequestMapping("/test")
    public String test(Integer age) {
        return "your age is " + age;
    }

    // 访问网址：http://localhost:8081/test/goods?id=1
    @RequestMapping("/goods")
    public HpGoods getGodos(int id) {
        HpGoods goods= goodsMapper.find(id);
        return goods;
    }
}
